define(['knockout', 'jquery', 'masonry', 'imageLoaded', 'css!/assets/css/mansory.css'], function(ko, $) {
	var vm = {
		shops: ko.observableArray(),
		init: function() {
			var that = this;
			$(function() {
				$.getJSON('/shop/json/example.json', function(returnData) {
					$.each(returnData.shops, function(index, data) {
						that.shops.push(data);
					});
				});
				var $item = $('.grid-item');
				$item.hide();
				var $grid = $('#grid');

				$grid.imagesLoaded(function() {
					$item.fadeIn();
					$grid.masonry({
						itemSelector: '.grid-item',
						percentPosition: true,
						columnWidth: '.grid-sizer',
						isAnimated: true
					});
				})

			});
		}
	};
	vm.init();
	return vm;
})